import request from '/@/utils/request';

// /api/manage/countyAppDeclare/getCountyAppDeclareList
// 区县化数字应用备案申报-列表
export function getCountyAppDeclareList(query?: Object) {
	return request({
		url: 'manage/countyAppDeclare/getCountyAppDeclareList',
		method: 'get',
		params: query,
	});
}

// 区县化数字应用备案-列表 新
export function getCountyDeclareList(query?: any) {
	if (query.timeArr) {
		query['beginTime'] = query.timeArr[0];
		query['endTime'] = query.timeArr[1];
	}
	delete query.timeArr;
	return request({
		url: 'manage/countyAppDeclare/list',
		method: 'post',
		data: query,
	});
}

// http://192.168.5.10:8888/api/manage/countyAppDeclare
// 区县化数字应用备案申报-新增
export function countyAppDeclare(data?: Object) {
	return request({
		url: 'manage/countyAppDeclare',
		method: 'post',
		data,
	});
}
// 查询flowCode
export function getFlowCode(param?: Object) {
	return request({
		url: 'manage/countyAppDeclare/flowCode',
		method: 'get',
		params: param,
	});
}
// 获取申报的参数
export function getAppDecParams(param?: Object) {
	return request({
		url: 'manage/countyAppDeclare/lastRecord',
		method: 'get',
		params: param,
	});
}
export function startProcessInstance(query?: object) {
	return request({
		url: `manage/process-instance/startProcessInstance`,
		method: 'post',
		data: query,
	});
}
// 区县化数字应用备案申报-修改
export function upDateCountyAppDeclare(data?: Object) {
	return request({
		url: 'manage/countyAppDeclare',
		method: 'put',
		data,
	});
}

// 区县数字化应用申报-详情
export function getCountyAppDeclare(id: Number) {
	return request({
		url: `manage/countyAppDeclare/${id}`,
		method: 'get',
	});
}

// 地区 or 责任部门
export function getAreaTree(query?: Object) {
	return request({
		url: 'admin/dept/getAreaTree',
		method: 'get',
		params: query,
	});
}
// 市级部门
export function getLevelList(query?: Object) {
	return request({
		url: 'admin/dept/levelList',
		method: 'get',
		params: query,
	});
}

// 区县数字化应用申报-删除
export function delAppDeclare(query?: any[]) {
	return request({
		url: `manage/countyAppDeclare`,
		method: 'delete',
		data: query,
	});
}

//区县数字化应用申报-申报
export function appDeclareById(id?: Number) {
	return request({
		url: `manage/countyAppDeclare/appDeclareById/${id}`,
		method: 'post',
	});
}
//区县数字化应用申报-申报 新
export function appDeclareStart(query?: Number) {
	return request({
		url: `manage/countyAppDeclare/approve`,
		method: 'post',
		data: query,
	});
}

//区县数字化应用申报/推送
export function appDeclareApprove(query?: object) {
	return request({
		url: `manage/task/completeTask`,
		// url: `manage/countyAppDeclare/approve`,
		method: 'post',
		data: query,
	});
}
//区县数字化应用申报
export function appDeclareApproves(query?: object) {
	return request({
		// url: `manage/task/completeTask`,旧版
		url: `manage/countyAppDeclare/completeTask`,
		// url: `manage/countyAppDeclare/approve`,
		method: 'post',
		data: query,
	});
}

//区县数字化应进度
export function pushPace(query?: Number) {
	return request({
		url: `manage/countyAppDeclare/pushPace`,
		method: 'post',
		data: query,
	});
}

//区县数字化应用撤回接口
export function returnTask(query?: any) {
	return request({
		// url: `manage/countyAppDeclare/returnTask`,
		url: `manage/task/cancelCompleteTask`,
		method: 'post',
		data: query,
	});
}

// 备案进度
export function runPathShow(param: Object) {
	return request({
		url: 'manage/countyAppDeclare/flowRecord',
		method: 'get',
		params: param,
	});
}

//导出
export function exportExcel(query?: any) {
	return request({
		url: 'manage/countyAppDeclare/excelExport',
		method: 'post',
		responseType: 'blob',
		data: query,
	});
}

// 数据存在校验
export function isExsitById(param: Object) {
	return request({
		url: '/manage/countyAppDeclare/getbyId',
		method: 'get',
		params: param,
	});
}

// 区县意见回复撤回成功的回调
export function pushDeptDelete(param: Object) {
	return request({
		url: '/manage/pushDept/delete',
		method: 'get',
		params: param,
	});
}
